<template>
  <div>
    <eagle-dialog
      title="选择计划重复频率"
      @open="onOpen"
      ref="eagleDialog"
      v-bind="$attrs"
      v-on="$listeners"
      :showButtons="false"
    >
      <eagle-radio-group
        v-model="id"
        direction="horizontal"
        style="margin: 0 20px"
      >
        <div
          v-for="(item, index) in data.CheckFrequencies"
          :key="index"
          :style="{ width: item.ID ? '50%' : '100%' }"
        >
          <eagle-radio :name="item.ID" v-if="item.ID" @click="chooseRadio(item.ID)">
            <span style="font-size: 14px">{{ item.Name }}</span>
          </eagle-radio>
        </div>
      </eagle-radio-group>
    </eagle-dialog>
  </div>
</template>
<script>
export default {
  name: "check-frequency-dialog",
  props: {
    data: {
      type: Object,
      default: () => null,
    },
  },
  data() {
    return {
      id:"",
    };
  },
  methods: {
    onOpen() {
      this.id="";
      if (this.data.CheckFrequency) {
        this.id = this.data.CheckFrequency;
      }
    },
    chooseRadio(id) {
      this.id = id;
      this.$emit("close", id);
    },
  },
};
</script>